<?php use_helper('Post', 'Date', 'I18N', 'Object', 'Validation') ?>

<div class="post hentry" id="post_<?php echo $post->getId() ?>">

  <h3 class="entry-title">
    <?php echo link_to_unless(
                 sfContext::getInstance()->getActionName() == 'displayOnePost',
                 $post->getTitle(), 
                 $post->getPermalink(), 
                 'absolute=true') ?>
  </h3>
  
  
  <p class="entry-informations">
    <span class="post-date">
    <?php echo format_date($post->getPublishedAt()) ?> 
    <?php echo __('at ') . $post->getPublishedAt('H:m') ?>
    </span>&nbsp;
    <span class="post-author">
    <?php echo __('by').' <strong>'.$post->getGuardUser()->getDisplayname().'</strong>' ?>
    </span>
  </p>
  
  <div class="entry-content">
    
    <?php if ($post->getExcerpt()): ?>
    <div class="entry-excerpt">
      <?php echo display_format_excerpt($post) ?>
    </div>
    <?php endif; ?>
    
    <div class="entry-body clearfix">
      <?php echo display_body_if_one_post($post) ?>
    </div>
    
  </div>
  
  <p class="metas">
  
    <?php if ($post->getTags()): ?>
    <span class="tags">
    <?php echo __('Publish in:') ?> 
      <?php foreach ($post->getTags() as $tag): ?>
        <?php echo link_to($tag, 'post/listByTag?tag='.$tag, 'class="tag"') ?>
      <?php endforeach; ?>
    </span>
    <?php endif; ?>
    
    <span class="comment-result">
    <?php echo link_to_unless(
                 sfContext::getInstance()->getActionName() == 'displayOnePost',
                 format_number_choice(
                 '[0]no reply|[1]1 reply|(1+Inf]%1% replies', 
                 array('%1%' => $post->countNoSpamComments()), 
                 $post->countNoSpamComments()
                 ),
                 $post->getPermalink().'#comments', 'absolute="true" title="'.__('go to the comment section').'"') ?>
    </span>
    
    <span class="entry-permalink">
      <?php echo link_to(__('Permalink'), $post->getPermalink(), 'title="'.__('Permalink to this article').'" absolute="true"') ?>
    </span>
  </p>

</div>


